﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace OneSystems.Data.Interfaces
{
    /// <summary>
    /// An abstraction used in order to make DataManager
    /// pluggable to improve automated unit testing
    /// capabilities.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IDataManager<T> where T : class
    {
        T Save(T entity);
        void SaveAll(IEnumerable<T> list);
        void Delete(T entity);
        void Delete(Int32 id);
        void DeleteAll(IEnumerable<T> list);
        T GetOne(Int32 id);
        void Refresh(T entity);
        IList<T> GetAll();
        IList<T> GetAll(Expression<Func<T, Boolean>> predicate);
        IQueryable<T> GetQueryable(Expression<Func<T, Boolean>> predicate);
        IQueryable<T> GetQueryable();
    }
}
